<div class="content-section introduction">
    <div class="feature-intro">
        <h1>TieredMenu</h1>
        <p>TieredMenu displays submenus in nested overlays.</p>
    </div>
    <app-demoActions github="tieredmenu" stackblitz="tieredmenu-demo"></app-demoActions>
</div>

<div class="content-section implementation">
    <div class="card">
        <h5>Inline</h5>
        <p-tieredMenu [model]="items"></p-tieredMenu>
    
        <h5>Popup</h5>
        <button #btn type="button" pButton icon="pi pi-bars" label="Show" (click)="menu.toggle($event)"></button>
        <p-tieredMenu #menu [model]="items" [popup]="true"></p-tieredMenu>
    </div>
</div>

<div class="content-section documentation">
    <p-tabView>
        <p-tabPanel header="Documentation">
            <h5>Import</h5>
<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
import &#123;TieredMenuModule&#125; from 'primeng/tieredmenu';
import &#123;MenuItem&#125; from 'primeng/api';
</app-code>

            <h5>MenuModel API</h5>
            <p>TieredMenu uses the common menumodel api to define its items, visit <a [routerLink]="['/menumodel']">MenuModel API</a> for details.</p>

            <h5>Getting Started</h5>
            <p>TieredMenu requires nested menuitems as its <i>model</i>.</p>
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;p-tieredMenu [model]="items"&gt;&lt;/p-tieredMenu&gt;
</app-code>

<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
export class TieredMenuDemo &#123;

    items: MenuItem[];

    ngOnInit() &#123;
        this.items = [
            &#123;
                label: 'File',
                items: [&#123;
                        label: 'New', 
                        icon: 'pi pi-fw pi-plus',
                        items: [
                            &#123;label: 'Project'&#125;,
                            &#123;label: 'Other'&#125;,
                        ]
                    &#125;,
                    &#123;label: 'Open'&#125;,
                    &#123;label: 'Quit'&#125;
                ]
            &#125;,
            &#123;
                label: 'Edit',
                icon: 'pi pi-fw pi-pencil',
                items: [
                    &#123;label: 'Delete', icon: 'pi pi-fw pi-trash'&#125;,
                    &#123;label: 'Refresh', icon: 'pi pi-fw pi-refresh'&#125;
                ]
            &#125;
        ];
    &#125;
&#125;
</app-code>

            <h5>Popup Mode</h5>
            <p>Menu is inline by default, popup mode is also supported by enabling <i>popup</i> property and calling toggle method by passing the event 
                    from the anchor element.</p>
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;p-tieredMenu #menu [model]="items" [popup]="true"&gt;&lt;/p-tieredMenu&gt;
&lt;button #btn type="button" pButton icon="pi pi-fw pi-list" label="Show" (click)="menu.toggle($event)"&gt;&lt;/button&gt;
</app-code>

            <h5>Animation Configuration</h5>
            <p>Transition of the open and hide animations can be customized using the <i>showTransitionOptions</i> and <i>hideTransitionOptions</i> properties, 
                example below disables the animations altogether.</p>
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;p-tieredMenu [showTransitionOptions]="'0ms'" [hideTransitionOptions]="'0ms'" #menu [model]="items" [popup]="true"&gt;&lt;/p-tieredMenu&gt;
&lt;button #btn type="button" pButton icon="pi pi-fw pi-list" label="Show" (click)="menu.toggle($event)"&gt;&lt;/button&gt;
</app-code>
            <h5>Properties</h5>
            <div class="doc-tablewrapper">
                <table class="doc-table">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Type</th>
                            <th>Default</th>
                            <th>Description</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>model</td>
                            <td>array</td>
                            <td>null</td>
                            <td>An array of menuitems.</td>
                        </tr>
                        <tr>
                            <td>popup</td>
                            <td>boolean</td>
                            <td>false</td>
                            <td>Defines if menu would displayed as a popup.</td>
                        </tr>
                        <tr>
                            <td>appendTo</td>
                            <td>any</td>
                            <td>null</td>
                            <td>Target element to attach the overlay, valid values are "body" or a local ng-template variable
                                of another element.</td>
                        </tr>
                        <tr>
                            <td>style</td>
                            <td>string</td>
                            <td>null</td>
                            <td>Inline style of the component.</td>
                        </tr>
                        <tr>
                            <td>styleClass</td>
                            <td>string</td>
                            <td>null</td>
                            <td>Style class of the component.</td>
                        </tr>
                        <tr>
                            <td>baseZIndex</td>
                            <td>number</td>
                            <td>0</td>
                            <td>Base zIndex value to use in layering.</td>
                        </tr>
                        <tr>
                            <td>autoZIndex</td>
                            <td>boolean</td>
                            <td>true</td>
                            <td>Whether to automatically manage layering.</td>
                        </tr>
                        <tr>
                            <td>autoDisplay</td>
                            <td>boolean</td>
                            <td>false</td>
                            <td>Whether to show a root submenu on mouse over.</td>
                        </tr>
                        <tr>
                            <td>showTransitionOptions</td>
                            <td>string</td>
                            <td>.12s cubic-bezier(0, 0, 0.2, 1)</td>
                            <td>Transition options of the show animation.</td>
                        </tr>
                        <tr>
                            <td>hideTransitionOptions</td>
                            <td>string</td>
                            <td>.1s linear</td>
                            <td>Transition options of the hide animation.</td>
                        </tr>
                    </tbody>
                </table>
            </div>
            
            <h5>Methods</h5>
            <div class="doc-tablewrapper">
                <table class="doc-table">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Parameters</th>
                            <th>Description</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>toggle</td>
                            <td>event: browser event</td>
                            <td>Toggles the visibility of the popup menu.</td>
                        </tr>
                        <tr>
                            <td>show</td>
                            <td>event: browser event</td>
                            <td>Displays the popup menu.</td>
                        </tr>
                        <tr>
                            <td>hide</td>
                            <td>-</td>
                            <td>Hides the popup menu.</td>
                        </tr>
                    </tbody>
                </table>
            </div>

            <h5>Styling</h5>
            <p>Following is the list of structural style classes, for theming classes visit <a href="#" [routerLink]="['/theming']">theming page</a>.</p>
            <div class="doc-tablewrapper">
                <table class="doc-table">
                    <thead>
                    <tr>
                        <th>Name</th>
                        <th>Element</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td>p-tieredmenu</td>
                        <td>Container element.</td>
                    </tr>
                    <tr>
                        <td>p-menu-list</td>
                        <td>List element.</td>
                    </tr>
                    <tr>
                        <td>p-menuitem</td>
                        <td>Menuitem element.</td>
                    </tr>
                    <tr>
                        <td>p-menuitem-text</td>
                        <td>Label of a menuitem.</td>
                    </tr>
                    <tr>
                        <td>p-menuitem-icon</td>
                        <td>Icon of a menuitem.</td>
                    </tr>
                    <tr>
                        <td>p-submenu-icon</td>
                        <td>Arrow icon of a submenu.</td>
                    </tr>
                    </tbody>
                </table>
            </div>

            <h5>Dependencies</h5>
            <p>None.</p>
        </p-tabPanel>

        <p-tabPanel header="Source">
            <a href="https://github.com/primefaces/primeng/tree/master/src/app/showcase/components/tieredmenu" class="btn-viewsource" target="_blank">
                <span>View on GitHub</span>
            </a>
            <a href="https://stackblitz.com/edit/primeng-tieredmenu-demo" class="btn-viewsource" style="margin-left: .5em;" target="_blank">
                <span>Edit in StackBlitz</span>
            </a>
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;h5&gt;Inline&lt;/h5&gt;
&lt;p-tieredMenu [model]="items"&gt;&lt;/p-tieredMenu&gt;

&lt;h5&gt;Popup&lt;/h5&gt;
&lt;button #btn type="button" pButton icon="pi pi-bars" label="Show" (click)="menu.toggle($event)"&gt;&lt;/button&gt;
&lt;p-tieredMenu #menu [model]="items" [popup]="true"&gt;&lt;/p-tieredMenu&gt;
</app-code>

<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
export class TieredMenuDemo &#123;

    items: MenuItem[];

    ngOnInit() &#123;
        this.items = [
            &#123;
            label:'File',
            icon:'pi pi-fw pi-file',
            items:[
                &#123;
                    label:'New',
                    icon:'pi pi-fw pi-plus',
                    items:[
                        &#123;
                        label:'Bookmark',
                        icon:'pi pi-fw pi-bookmark'
                        &#123;,
                        &#123;
                        label:'Video',
                        icon:'pi pi-fw pi-video'
                        &#123;,

                    ]
                &#123;,
                &#123;
                    label:'Delete',
                    icon:'pi pi-fw pi-trash'
                &#123;,
                &#123;
                    separator:true
                &#123;,
                &#123;
                    label:'Export',
                    icon:'pi pi-fw pi-external-link'
                &#123;
            ]
            &#123;,
            &#123;
            label:'Edit',
            icon:'pi pi-fw pi-pencil',
            items:[
                &#123;
                    label:'Left',
                    icon:'pi pi-fw pi-align-left'
                &#123;,
                &#123;
                    label:'Right',
                    icon:'pi pi-fw pi-align-right'
                &#123;,
                &#123;
                    label:'Center',
                    icon:'pi pi-fw pi-align-center'
                &#123;,
                &#123;
                    label:'Justify',
                    icon:'pi pi-fw pi-align-justify'
                &#123;,

            ]
            &#123;,
            &#123;
            label:'Users',
            icon:'pi pi-fw pi-user',
            items:[
                &#123;
                    label:'New',
                    icon:'pi pi-fw pi-user-plus',

                &#123;,
                &#123;
                    label:'Delete',
                    icon:'pi pi-fw pi-user-minus',

                &#123;,
                &#123;
                    label:'Search',
                    icon:'pi pi-fw pi-users',
                    items:[
                        &#123;
                        label:'Filter',
                        icon:'pi pi-fw pi-filter',
                        items:[
                            &#123;
                                label:'Print',
                                icon:'pi pi-fw pi-print'
                            &#123;
                        ]
                        &#123;,
                        &#123;
                        icon:'pi pi-fw pi-bars',
                        label:'List'
                        &#123;
                    ]
                &#123;
            ]
            &#123;,
            &#123;
            label:'Events',
            icon:'pi pi-fw pi-calendar',
            items:[
                &#123;
                    label:'Edit',
                    icon:'pi pi-fw pi-pencil',
                    items:[
                        &#123;
                        label:'Save',
                        icon:'pi pi-fw pi-calendar-plus'
                        &#123;,
                        &#123;
                        label:'Delete',
                        icon:'pi pi-fw pi-calendar-minus'
                        &#123;,

                    ]
                &#123;,
                &#123;
                    label:'Archieve',
                    icon:'pi pi-fw pi-calendar-times',
                    items:[
                        &#123;
                        label:'Remove',
                        icon:'pi pi-fw pi-calendar-minus'
                        &#123;
                    ]
                &#123;
            ]
            &#123;,
            &#123;
            separator:true
            &#123;,
            &#123;
            label:'Quit',
            icon:'pi pi-fw pi-power-off'
            &#123;
        ]
    &#125;
&#125;
</app-code>
        </p-tabPanel>
        <p-tabPanel header="StackBlitz">
            <ng-template pTemplate="content">
                <iframe src="https://stackblitz.com/edit/primeng-tieredmenu-demo?embed=1" style="width: 100%; height: 768px; border: none;"></iframe>
            </ng-template>
        </p-tabPanel>
    </p-tabView>
</div>